//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CJFFS2FILE_H__)
#define __CJFFS2FILE_H__

#include "_CJffs2File.h"
#include "nodelist.h"

class CJffs2File : public _CJffs2File
{
public:
    CARAPI Read(
                    /* [in] */ UInt32 offset,
                    /* [in] */ UInt32 toRead,
                    /* [out] */ MemoryBuf * pBuf);

    CARAPI Write(
                    /* [in] */ UInt32 offset,
                    /* [in] */ const MemoryBuf & ezbBuf,
                    /* [out] */ UInt32 * pWrite);

    CARAPI GetSize(
                    /* [out] */ UInt32 * pSize);

    CARAPI SetSize(
                    /* [in] */ UInt32 size);

    CARAPI GetOptimalBlockSize(
                    /* [out] */ UInt32 * pSize);

    CARAPI Sync();

    CARAPI GetType(
                    /* [out] */ enum FileType * pType);

    CARAPI GetAccessTime(
                    /* [out] */ Int32 * pTime);

    CARAPI SetAccessTime(
                    /* [in] */ Int32 time);

    CARAPI GetModificationTime(
                    /* [out] */ Int32 * pTime);

    CARAPI SetModificationTime(
                    /* [in] */ Int32 time);

    CARAPI GetCreateTime(
                    /* [out] */ Int32 * pTime);

    CARAPI CheckAccessMode(
                    /* [in] */ enum FileAccessMode mode);

    CARAPI GetAccessMode(
                    /* [out] */ enum FileAccessMode * pMode);

    CARAPI SetAccessMode(
                    /* [in] */ enum FileAccessMode mode);

    CJffs2File(n_file file):m_file(file)
    {
    }
    ;

    ~CJffs2File();

    CARAPI AddFileMonitor(
                    /* [in] */  Boolean   bManualReset,
                    /* [in] */  UInt32  dwInitialState,
                    /* [out] */ IEvent **pEvent);

    CARAPI RemoveFileMonitor(
                    /* [in] */ IEvent *pEvent);

private:
    // TODO: Add your private member variables here
    //inline void Lock();
    //inline void Unlock();
    n_file m_file;
};

#endif //!(__CJFFS2FILE_H__)
